//
//  DownloadListCell.m
//  DownloadManagerDemo
//
//  Created by ejiang on 2021/12/13.
//

#import "DownloadListCell.h"

@implementation DownloadListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.progressView.progressTintColor = [UIColor orangeColor];
    
    __weak typeof(self) weak_self = self;
    MGSwipeButton * retryBtn = [MGSwipeButton buttonWithTitle:@"重下" backgroundColor:[UIColor orangeColor] callback:^BOOL(MGSwipeTableCell * _Nonnull cell) {
        if ([weak_self.actionDelegate respondsToSelector:@selector(downloadListCellDidClickRetry:)]) {
            [weak_self.actionDelegate downloadListCellDidClickRetry:weak_self];
        }
        return YES;
    }];
    MGSwipeButton * delBtn = [MGSwipeButton buttonWithTitle:@"删除" backgroundColor:[UIColor redColor] callback:^BOOL(MGSwipeTableCell * _Nonnull cell) {
        if ([weak_self.actionDelegate respondsToSelector:@selector(downloadListCellDidClickDel:)]) {
            [weak_self.actionDelegate downloadListCellDidClickDel:weak_self];
        }
        return YES;
    }];
    self.rightButtons = @[
        retryBtn,
        delBtn,
    ];
    self.rightSwipeSettings.transition = MGSwipeTransitionBorder;
}


@end
